<%@ page language="java" import="java.util.*"  pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%
String path=request.getContextPath();
String basePath=request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.or/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<base href="<%=basePath %>">
<title>规则配置</title>
<%@ include file="/WEB-INF/jsp/common/common.jsp" %>
<script src="<%=path%>/js/jquery.divbox.js" type="text/javascript"></script>
<script type="text/javascript">
function queryList() {
	window.location.href="<%=path%>/ruleAgentConfig/list";
}
function updateRuleAgent() {
	var strReg = "[0-9]{4}-[0-9]{2}-[0-9]{2}";
	var ruleAgentId = $("#ruleAgentId").val();
	var effDate =$("#effDate").val();
	var termDate =$("#termDate").val();
	var ruleAgentDesc =$("#ruleAgentDesc").val();
	var status =$("#status").val();
	var premium = $("#premium").val();
	 if(null != effDate && "" != effDate){
			if(effDate.match(strReg)==null){
				$.message("error", "您输入的定义起期格式不正确，格式为:YYYY-MM-DD");
				return;
			}
		}
		if(null != termDate && "" != termDate){
			if(termDate.match(strReg)==null){
				$.message("error", "您输入的定义止期格式不正确，格式为:YYYY-MM-DD");
				return;
			}
		}
	$.ajax({
		url:"<%=path%>/ruleAgentConfig/updateRuleAgent?"+new Date().getTime(),
		type:"POST",
		async : true,
		dataType:'json',
		data:{
			ruleAgentId:ruleAgentId,
			effDate:effDate,
			termDate:termDate,
			ruleAgentDesc:ruleAgentDesc,
			premium:premium,
			status:status
			},
		success : function(obj) {
			//表单状态
			Formstatus=true;
			$.closeLoading();
			if($.validate(obj))return;
			$.dialog({
				type: "success",//success,error
				content: "更新成功,点击确定跳转列表",
				onCancel:function(){
					
				},
				onOk: function() {
					queryList();
					return;
				}
			});
			
		}
	});
		
}

</script>
</head>
<body>
	<div class="current">
		<table class="current_table_1">
			<tbody>
				<tr class="f2">
				<td><img src="./images/current_1.jpg"></td>
				 <td class="current_table_1_td">
                   <img src="images/current_1.png">&nbsp;您现在的位置：&nbsp;
                     <span style=" color:#136bab; ">界面出单管理
                     <span style="padding:0 5px; font-weight:bold; line-height:28px;">&gt;</span>录单二维码管理
                     <span style="padding:0 5px; font-weight:bold; line-height:28px;">&gt;</span>录单二维码编辑
                 </span>
                 </td>
                 <td><img src="./images/current_3.jpg"></td>
				</tr>
			</tbody>
		</table>
	</div>
	<form id="inputForm">
	        <table class="table_05">
              <tbody>
	              <tr>
	                  <td colspan="4" style=" font-size:12px; font-weight:bold; text-align:left;color:#3876bf; line-height:17px; background-image:url(images/centent_1.jpg)">
							录单二维码编辑
	                  </td>
	              </tr>
	              <tr>
	                  <th>规则编号：</th>
	                  <td style="width: 300px;">
	                  	<input name="ruleId" id="ruleId"  value="${RULEID}" readonly="readonly" style="width: 150px;background-color: #ccc;" class="input_text">&nbsp;
	                  </td>
	                  <th>规则名称：</th>
	                  <td style="width: 300px;">
	                  	<input name="ruleName" id="ruleName" value="${RULENAME}" readonly="readonly" style="background-color: #ccc;width: 150px" class="input_text">&nbsp;
	                  </td>
	                 
	              </tr>
	              <tr>
	             	  <th>有效起期：</th>
	                  <td>
						<input id="effDate" style="width: 150px" value="${EFFDATE}" onkeydown="false" onclick="showCalendar('effDate','y-mm-dd');" readonly="readonly" class="input_time" type="text" />
	                  </td>
	             	  <th>有效止期：</th>
	                  <td>
						<input id="termDate" style="width: 150px" value="${TERMDATE}" onkeydown="false" onclick="showCalendar('termDate','y-mm-dd');" readonly="readonly" class="input_time" type="text" />
	                  </td>
	               </tr>
				  <tr>
					  <th>状态：</th>
					  <td>
						  <select id="status" class="select_1" style="visibility: visible;width: 150px">
							  <option selected="selected" value="1">有效</option>
							  <option value="0">无效</option>
						  </select>
					  </td>
					  <th>保费：</th>
					  <td><input id="premium" style="width: 150px" value="${PREMIUM}" class="input_text"></td>
				  </tr>
	               		<th>二维码描述：</th>
	                  <td colspan="3" >
	                  	<textarea name="ruleAgentDesc" id="ruleAgentDesc" rows="5" class="textarea_1" style="resize:none;">${RULEAGENTDESC}</textarea>
	                  </td>
	              </tr>
	              <tr id="sale1" >
		             <td colspan="4" style=" font-size:12px; font-weight:bold; text-align:left;color:#3876bf; line-height:17px; background-image:url(images/centent_1.jpg)">
							代理信息
	                  </td>
		          </tr>
		          <tr>
	                  <th>代理人编码：</th>
	                  <td style="width: 300px;">
	                  	<input name="" id="userCode" value="${USERCODE}" readonly="readonly" style="width: 150px;background-color: #ccc;" class="input_text">&nbsp;
	                  </td>
	                  <th>代理人名称：</th>
	                  <td style="width: 300px;">
	                  	<input name="" id="userName" value="${USERNAME}" readonly="readonly" style="width: 150px;background-color: #ccc;" class="input_text">&nbsp;
	                  </td>
	                 
	              </tr>
		          <tr>
	                  <th>业务员代码：</th>
	                  <td style="width: 300px;">
	                  	<input name="empCode" id="empCode"  value="${EMPCODE}"  readonly="readonly" style="width: 150px;background-color: #ccc;" class="input_text">&nbsp;
	                  </td>
	                  <th>业务员名称：</th>
	                  <td style="width: 300px;">
	                  	<input name="empName" id="empName" value="${EMPNAME}"   readonly="readonly" style="width: 150px;background-color: #ccc;" class="input_text">&nbsp;
	                  </td>
	                 
	              </tr>
		          <tr>
	                  <th>出单机构：</th>
	                  <td style="width: 300px;">
	                  	<input name="comCode" id="comCode" value="${COMCODE}"  readonly="readonly" style="width: 150px;background-color: #ccc;" class="input_text">&nbsp;
	                  </td>
	              </tr>
		          <tr style="display: none">
	                  <th>出单机构：</th>
	                  <td style="width: 300px;">
	                  	<input name="ruleAgentId" id="ruleAgentId" value="${ID}"  readonly="readonly" style="width: 150px;background-color: #ccc;" class="input_text">&nbsp;
	                  </td>
	              </tr>
		</tbody>
		</table>
		</form>
		<div align="center" style="margin-top: 7px;">
		<input id="sub" class="input_button_1" name="" type="button"
			value="保存" onclick="updateRuleAgent()">&nbsp;&nbsp; <input
			class="input_button_1" name="" onclick="queryList()" type="button"
			value="取消">
		</div>
</body>
</html>